#pragma once

#include "ComponentBase.h"
#include "algorithm.h"
#include "algorithmvisual.h"

class AlgorithmManager : public ComponentBase
{
	Q_OBJECT

public:
	AlgorithmManager(QObject* parent);
	~AlgorithmManager();
	// 组件初始化处理函数
	virtual int ComponentInit() override;
	/*自检接口*/
	virtual bool ComponentCheckSelfState() override;
	/*复位接口*/
	virtual bool ComponentSelfReset() override;

	// 命令执行接口
	virtual bool ExcuteCmd(int cmd, const QByteArray& input, QByteArray& output) override;

	QStringList GetAllAlgName();
	Algorithm* GetAlgObjectByName(const QString& name);
	QStringList GetAllVisAlgName();
	AlgorithmVisual* GetVisAlgObjectByName(const QString& name);
private:
	bool ReadAlgPlugin(const QString& dir);
	bool ReadVisualALgPlugin(const QString& dir);
private:
	std::map<QString, AlgorithmPlugin*> m_algMap;
	std::map<QString, AlgorithmVisualPulgin*> m_visAlgMap;
};
